<template>
  <div class="layout-aside-container">
    <!-- 左侧边栏列表 -->
    <ul class="user-select-none menu">
      <li class="menu-item">
        <router-link to="/home/MapHomePage">志愿活动展示</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/VoluntaryStatistics">志愿服务统计</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/MyVoluntary" v-if="Identity==='Voluntary'">我参加的志愿活动</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/MyOrganizationVoluntary" v-if="Identity==='Organization'">我组织的志愿活动</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/CreateActivity" v-if="Identity==='Organization'">创建新的志愿</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/AllVoluntary" v-if="Identity==='Manager'">全部志愿者</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/AllOrganization" v-if="Identity==='Manager'">全部组织者</router-link>
      </li>
      <li class="menu-item">
        <router-link to="/home/AllaActivity" v-if="Identity==='Manager'">全部活动</router-link>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'MyAside',
  data(){
    return{
      Identity:''
    }
  },
  created(){
    this.Identity=localStorage.getItem('Identity')
  }
}
</script>

<style lang="less" scoped>
.layout-aside-container {
  width: 250px;
  height: 100%;
  border-right: 1px solid #eaeaea;
}

.menu {
  list-style-type: none;
  padding: 0;
  .menu-item {
    line-height: 50px;
    font-weight: bold;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
      'Helvetica Neue', sans-serif;
    &:hover {
      background-color: #efefef;
      cursor: pointer;
    }
    a {
      display: block;
      color: black;
      padding-left: 30px;
      &:hover {
        text-decoration: none;
      }
    }
  }
}

// 设置路由高亮效果
.router-link-active {
  background-color: #efefef;
  box-sizing: border-box;
  position: relative;
  // 伪元素实现路由高亮效果
  &::before {
    content: ' ';
    display: block;
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background-color: #42b983;
  }
}
</style>
